<?php

header("Content-type:text/html;charset=UTF-8");

session_start();
if (empty($_SESSION['id'])) {
    echo '{"code":"400","msg":"未登录"}';

    die();
}
$id = addslashes($_GET['id']);

$conn = mysqli_connect('127.0.0.1', 'root', 'root', 'lzp');
mysqli_query($conn, 'set names utf8');
$sql = "select * from p_tn18 where id='$id'";
//执行 sql
$result = mysqli_query($conn, $sql);
$info = mysqli_fetch_assoc($result);
// var_dump($info);
// while
$data = json_encode($info);
echo $data;